<script type="text/javascript" >
    stFacebookToolbox.load_tooltip();
    stFacebookToolbox.on_submitform('#stFacebookToolboxForm', function(data){
        stFacebookToolbox.sendMessage("Save Success");
    });
    stFacebookToolbox.loadUploadButton('200');
    stFacebookToolbox.loadRemoveButton();
    stFacebookToolbox.shortAction();
        jQuery("a[rel^='prettyPhoto']").prettyPhoto({
            theme:'facebook',
            default_height:100,
            keyboard_shortcuts: false
        });
   function set_flickr(checked){
       if(checked){
           jQuery("#set_flickr").slideDown();
           //jQuery("#set_use").slideDown();
           jQuery("#id").val(jQuery("#save_id").val());
       }
       else {
            jQuery("#set_flickr").slideUp();
            //jQuery("#set_use").slideUp();
            jQuery("#id").val('');
       }
   }
   function set_use(value){
       if(value == 'input'){
           jQuery("#flick_input").slideDown();
           jQuery("#yahoo_login").slideUp();
       }
       else
           {
                jQuery("#yahoo_login").slideDown();
                jQuery("#flick_input").slideUp();
           }
   }
</script>
<?php 
if(isset($edit)){
    $display = 'display: block;';
    $edit_data = json_decode($edit);
    $check = true;
}
else 
{
    $display = 'display: none;';
    $check = false;
}
$setting = (json_decode($option['response']));
$checked = '';
$display = '';
if($option['id'] != ''){
    $checked = 'checked';
    $display = 'display:block';
}else{
    $checked = '';
    $display = 'display:none';
}
?>
<div class="w100p bgl">
    <div class="w100p bgr p5b">

         <form class="stform" id="stFacebookToolboxForm" action="<?php echo admin_url('/admin.php?page=' . $config['plugin_name'] . '&action=' . $current_action) ?>" method="post" >
             <ul>
<!--                  <li>
                        <label style="width:135px;padding-top:4px;">Use picture from Flickr:</label>
                        <div>
                            <input type="checkbox" name="data[user]" value="1" <?php echo $checked;?> onclick="set_flickr(this.checked);" />
                            <input type="hidden" value="<?php echo $option['id'];?>" id="save_id" />
                        </div>
                        <br clear="both" />
                    </li>
                    <li id="set_use" style="<?php// echo $display;?>display:none;">
                        <label style="width:135px;padding-top:4px;">Use:</label>
                        <div>
                            <select id="user" name="data[set]" onchange="set_use(this.value)">
                                <option value="input" <?php if($option['set'] == 'input'){echo 'selected';}?>>Input manual</option>
                                <option value="yahoo" <?php if($option['set'] == 'yahoo'){echo 'selected';}?>>Yahoo login</option>
                            </select>
                        </div>
                        <br clear="both" />
                    </li>
                  <li id="set_flickr" style="<?php echo $display;?>">
                        <label style="width:135px;padding-top:4px;">Set Flickr ID:</label>
                        <div>
                            <div id="flick_input" style="width:300px;<?php// if($option['set'] == 'yahoo'){echo 'display:none;';} ;?>"><input type="text" id="id" name="data[id]" value="<?php echo $option['id'];?>" style="width:150px;" onkeyup="jQuery('#save_id').val(this.value);"/></div>
                            <div id="yahoo_login" style="width:300px;<?php if($option['set'] == 'input'){echo 'display:none;';} ;?>"><img src="<?php echo $config['imagesUrl'];?>yahoo.png" id="display_yahoo_connect" style="cursor:pointer;" onclick="window.location = '<?php echo $config['classPath'].'flickr/auth.php'; ;?>';" /></div>
                        </div>
                        <br clear="both" />
                    </li>-->
                     <li>
                        <label style="width:135px;padding-top:4px;">Gallery version:</label>
                        <div>
                            <select name="data[version]">
                                <option value="1" <?php if(intval($option['version']) == 1){echo 'selected';} ?>>Standard version</option>
                                <option value="2" <?php if(intval($option['version']) == 2){echo 'selected';} ?>>Custom version</option>
                            </select>
                        </div>
                        <br clear="both" />
                    </li>
                    <li>
                        <label style="width:135px;padding-top:4px;">Embed code:</label>
                        <div>
                            <textarea name="data[embed]" id="embed"><iframe src="http://demo.socialmediatoolbox.no/gallery/?id=<?php echo intval($user_id);?>" width="540" frameborder="0" border="0" style="border-width:0px;" >
                                <p>Your browser does not support iframes.</p>
                            </iframe>
                                
                            </textarea>
                        </div>
                        <br clear="both" />
                    </li>
                    <li>
                            <label  style="width:135px;padding-top:4px;">Background:</label>
                            <div class="">
                                <?php
                        $class_hide = "hide";
                        if (!empty($option['background'])) {
                            $upload_data = wp_upload_dir();
                            $picture = explode('wp-content/',$option['background']);
                            $picture = '../wp-content/'.$picture[1];
                            $picture = substr($picture,0,strlen($picture)-4).'-thumb'.substr($picture,-4,4);
                            $class_hide = "";
                        }
                        ?>
                                <input type="hidden" <?php if(!empty($option['background'])){echo "value='{$option['background']}'";} ?> id="id_upload_file" name="data[upload_file]" class="" value="">
                                <div class="upload_button_div">
                                    <span class="button image_upload_button" id="upload_file">Upload Image</span>
                                    <span class="button image_reset_button <?php echo $class_hide ?>" id="reset_upload_file" pictureid="upload_file">Remove</span>
                                </div>  
                                <?php
                             if ($option['background'] != '') {
                                 ?>
                            <img alt="" src="<?php echo $picture;?>" id="image_upload_file" class="hide preview" style="display: inline;"/>
                        <?php } ?>
                            </div>
                            <br clear="all">
                        </li>
                    <li>
                        <input type="submit" value="Save" />
                    </li>
                    
             </ul>
         </form>
    </div>
</div>
<script>
    jQuery(".current .have_child").html('');
</script>